package com.fyp.ptma.dao.service.iservice;

import javax.persistence.PersistenceException;

import org.hibernate.exception.ConstraintViolationException;

/**
 * 
 * @author YahyaArshad <br>
 *         Every Service should extends this interface. Every class implementing
 *         its concrete implementation should provide implementation should
 *         provide implementation for CRUD methdos and call respective Dao
 *         Implementation
 * 
 */

public abstract interface IService {
	/**
	 * 
	 * @param objToSave
	 * @return
	 * @throws PersistenceException
	 * @throws ConstraintViolationException
	 */
	public Long save(Object objToSave) throws PersistenceException,
			ConstraintViolationException;

	/**
	 * 
	 * @param objToSave
	 * @throws PersistenceException
	 * @throws ConstraintViolationException
	 */
	public void saveOrUpdate(Object objToSave) throws PersistenceException,
			ConstraintViolationException;

	/**
	 * 
	 * @param objToUpdate
	 * @return
	 * @throws PersistenceException
	 */
	public Long update(Object objToUpdate) throws PersistenceException;

	/**
	 * 
	 * @param objToDelete
	 * @return
	 * @throws PersistenceException
	 * @throws ConstraintViolationException
	 */
	public boolean delete(Object objToDelete) throws PersistenceException,
			ConstraintViolationException;

}
